Fix API Error Handling to Prevent Internal Error Leakage#8282
Fix API Error Handling to Prevent Internal Error Leakage#8282atul-upadhyay-7 wants to merge 1 commit into
Conversation
|
@atul-upadhyay-7 is attempting to deploy a commit to the jhasourav07's projects Team on Vercel. A member of the Team first needs to authorize it. |
|
This pull request enhances the error handling of the |
📦 Next.js Bundle Size Report (Gzipped Sizes)✨ No significant bundle size changes detected. 📊 Summary of Totals
|
Aamod007
left a comment
There was a problem hiding this comment.
Thanks for updating the error handling in \�pp/api/github/route.ts\ to prevent internal error leakage. The changes in the route and test files are correct.
However, it looks like you've accidentally committed several rogue testing files and logs (\ est_next_request.ts, \ est_output.log, \ est_output2.log, and \ est_request.ts).
How to fix:
Please revert or remove these unrelated files from your branch so we only merge the API fix. You can do this by running \git rm test_output.log test_output2.log test_request.ts test_next_request.ts, committing the removal, and pushing it to this branch.
I am requesting changes until these files are removed.
Label Justification:
- \level:critical: Assigned based on 7 files changed (though most are accidental).
- \ ype:bug: Fixes internal error leakage.
- \mentor:Aamod007: Assigned as required.
Description
Fixes #8280
The
/api/githubroute handler was returning rawerror.messagestrings directly to the client in the default 500 fallback via thegetSafeErrorMessagehelper. This inadvertently leaked internal Node.js stack traces, backend connection errors (likeECONNREFUSED), and raw upstream GitHub API responses.This PR:
"An unexpected error occurred. Please try again.").logger.errorinfrastructure.getSafeErrorMessagehelper.route.test.tsandroute.error-resilience.test.ts) that previously asserted the presence of the raw error strings, so they now assert the generic fallback string instead.Pillar
Visual Preview
N/A - Backend API logic change only.
Checklist before requesting a review:
CONTRIBUTING.mdfile.localhost:3000/api/streak?user=YOUR_USERNAME).npm run formatandnpm run lintlocally and resolved all errors (CI will fail otherwise).feat(themes): ...,fix(calculate): ...).README.mdif I added a new theme or URL parameter.